LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := haproxy
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/ebtree
LOCAL_SRC_FILES := \
    src/haproxy.c src/base64.c src/protocol.c src/uri_auth.c src/standard.c \
    src/buffer.c src/log.c src/task.c src/chunk.c src/channel.c src/listener.c \
    src/lru.c src/xxhash.c src/time.c src/fd.c src/pipe.c src/regex.c \
    src/cfgparse.c src/server.c src/checks.c src/queue.c src/frontend.c \
    src/proxy.c src/peers.c src/arg.c src/stick_table.c src/proto_uxst.c \
    src/connection.c src/proto_http.c src/raw_sock.c src/backend.c \
    src/tcp_rules.c src/lb_chash.c src/lb_fwlc.c src/lb_fwrr.c src/lb_map.c \
    src/lb_fas.c src/stream_interface.c src/stats.c src/proto_tcp.c \
    src/applet.c src/session.c src/stream.c src/hdr_idx.c src/ev_select.c \
    src/signal.c src/acl.c src/sample.c src/memory.c src/freq_ctr.c src/auth.c \
    src/proto_udp.c src/compression.c src/payload.c src/hash.c src/pattern.c \
    src/map.c src/namespace.c src/mailers.c src/dns.c src/vars.c src/filters.c \
    src/flt_http_comp.c src/flt_trace.c src/flt_spoe.c src/cli.c src/ev_poll.c \
    src/ev_epoll.c ebtree/ebtree.c ebtree/eb32tree.c ebtree/eb64tree.c \
    ebtree/ebmbtree.c ebtree/ebsttree.c ebtree/ebimtree.c ebtree/ebistree.c
LOCAL_STATIC_LIBRARIES := libz libpcre
LOCAL_CFLAGS := \
    -Wall -O2 -g -fno-strict-aliasing -Wdeclaration-after-statement \
    -DCONFIG_HAP_LINUX_SPLICE -DTPROXY -DCONFIG_HAP_LINUX_TPROXY \
    -DUSE_ZLIB -DENABLE_POLL -DENABLE_EPOLL -DUSE_CPU_AFFINITY \
    -DASSUME_SPLICE_WORKS -DUSE_ACCEPT4 -DNETFILTER -DUSE_GETSOCKNAME \
    -DUSE_PCRE -DCONFIG_HAPROXY_VERSION=\"1.7.3\" -DCONFIG_HAPROXY_DATE=\"2017/02/28\"
ifeq ($(ANDROID_SELECT),true)
LOCAL_CFLAGS += -DANDROID_SELECT
endif
ifeq ($(USE_OPENSSL),true)
LOCAL_CFLAGS += -DUSE_OPENSSL -DCONFIG_HAP_CRYPT
LOCAL_STATIC_LIBRARIES += libssl libcrypto
endif
LOCAL_LDFLAGS := -ldl -pie
include $(BUILD_EXECUTABLE)
